package com.cskaoyan.dbutils;

import com.cskaoyan.others.DruidUtils;
import com.cskaoyan.vo.Account;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * 创建日期: 2021/11/25 16:18
 *
 * @author ciggar
 */
public class BeanListHandlerDemo {

    public static void main(String[] args) throws SQLException {

        // 获取QueryRunner
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        // 执行SQL
        List<Account> list = queryRunner.query("select * from account where id in (?,?,?)",new BeanListHandler<>(Account.class),1,2,3);


        System.out.println(list);
    }
}
